//
//  MultiChannTestProc_one.h
//  GPUProcessingTesting
//
//  Created by kadlubek47 on 17.06.2013.
//  Copyright (c) 2013 kadlubek47. All rights reserved.
//

#ifndef __GPUProcessingTesting__MultiChannTestProc_one__
#define __GPUProcessingTesting__MultiChannTestProc_one__

#include <vector>

#include "OpenCLProcessorBase.h"
#include "Timer.h"

//Multi channel testing processor - one buffer for all channels
class MultiChannTestProc_one: public OpenCLProcessorBase {
public:
    
    MultiChannTestProc_one();
    ~MultiChannTestProc_one();
    
    void process(float* channels, unsigned int channelsNum, unsigned int channelLength, float* destiny, double* timeOfCallCommandsFun, double* timeOfFlushAndFinish);
    
private:
    
    //Kernel
    static const char kernelPath_[];
    cl_kernel inOutKernel_;
    void createKernels();
    
    //Buffers
    bool createdBuffers_ = false;
    cl_mem bufferIn_, bufferOut_, buffer_channelsInfo_;
    unsigned int channelsNum_ = 0;
    unsigned int channelLength_ = 0;
    
    void createBuffers();
    void loadBlocksOfChannelsIntoGPU(float* channels);
    void executeKernel();
    void getBlocksOfChannelsFromGPU (float* destiny);
};

#endif /* defined(__GPUProcessingTesting__MultiChannTestProc_one__) */







